﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site/QuanLyDuoc/QuanLyDuoc_OffCanvas.Master" AutoEventWireup="true" CodeBehind="PhieuXuatBanLe.aspx.cs" Inherits="HospitalManager.QuanLyDuoc.HeThongNhapXuat.PhieuXuatBanLe.PhieuXuatBanLe" %>

<%@ Register Src="~/QuanLyDuoc/HeThongNhapXuat/PhieuXuatBanLe/uc_Phieu.ascx" TagName="uc_Phieu" TagPrefix="uc1" %>
<%@ Register Src="~/QuanLyDuoc/HeThongNhapXuat/PhieuXuatBanLe/uc_ChiTietPhieu.ascx" TagName="uc_ChiTietPhieu" TagPrefix="uc2" %>
<%@ Register Src="../HeThongNhapXuat_LeftMenu.ascx" TagName="HeThongNhapXuat_LeftMenu" TagPrefix="uc3" %>
<%@ Register Src="~/QuanLyDuoc/HeThongNhapXuat/PhieuXuatBanLe/uc_ViewPhieu.ascx" TagName="uc_ViewPhieu" TagPrefix="uc4" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script src="../../../AjaxJquery/QuanLyDuoc/HeThongNhapXuat/jsPhieuXuatBanLe.js"> </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="LeftContent" runat="server">
    <uc3:HeThongNhapXuat_LeftMenu ID="HeThongNhapXuat_LeftMenu1" runat="server" />
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <div class="row">
        <div class="col-xs-12 col-md-12">
            <div class="page-header" style="margin: 0 0 10px;">
                <h1 style="margin: 0; font-weight: bold; color: #3070A7; font-size: 30px;">
                    <small class="breadcrumb" style="font-size: 50%; background-color: #ffffff; padding: 0 15px;">
                        <li><a href="/duoc/nhap-xuat">HỆ THỐNG NHẬP XUẤT</a></li>
                        <li class="active">PHIẾU XUẤT BÁN LẺ</li>
                    </small>
                </h1>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-xs-12 col-md-12">
            <div class="col-xs-3 col-md-3">
                <asp:DropDownList ID="ddlKho_Khoa" ClientIDMode="Static" runat="server">
                </asp:DropDownList>
            </div>
            <div class="col-xs-4 col-md-4">
                <div class="input-group">
                    <span class="input-group-addon">Từ ngày</span>
                    <asp:TextBox ID="txtTuNgay" ClientIDMode="Static" runat="server" CssClass="form-control ipdate dateFormat"
                        placeholder="Từ ngày"></asp:TextBox>
                    <span class="input-group-addon" style="border-right: 0;">đến ngày</span>
                    <asp:TextBox ID="txtDenNgay" ClientIDMode="Static" runat="server" CssClass="form-control ipdate dateFormat"
                        placeholder="Đến ngày"></asp:TextBox>
                </div>
            </div>
            <div class="col-xs-3 col-md-3">
                <asp:Button ID="btnTimKiem" ClientIDMode="Static" runat="server" Text="Tìm kiếm" CssClass="btn btn-default"
                    OnClientClick=" validationform_Timkiem() " OnClick="btnTimKiem_Click" />
                <asp:LinkButton runat="server" ID="btnThemPhieuXuatBanLe" ClientIDMode="Static" Text="Thêm mới" CssClass="btn btn-success"
                    OnClientClick=" themphieuxuatbanle() " href="javascript:void(0)"></asp:LinkButton>
            </div>
        </div>
    </div>
    <div class="row" style="margin-top: 10px;">
        <div class="col-md-12">
            <div class="form-group table-responsive">
                <asp:GridView ID="gvPhieuXuatBanLe" runat="server" AutoGenerateColumns="False" Width="100%"
                    CssClass="table table-bordered table-condensed" DataKeyNames="MaPhieu" OnRowDataBound="gvPhieuXuatBanLe_RowDataBound">
                    <Columns>
                        <asp:BoundField DataField="RowNumber" HeaderText="STT">
                            <ItemStyle HorizontalAlign="Center"></ItemStyle>
                        </asp:BoundField>
                        <asp:BoundField DataField="NgayGiao" HeaderText="Ngày giao" DataFormatString="{0:dd-MM-yyyy}">
                            <ItemStyle HorizontalAlign="Center"></ItemStyle>
                        </asp:BoundField>
                        <asp:BoundField DataField="TenKho" HeaderText="Tên kho"></asp:BoundField>
                        <asp:BoundField DataField="TenKhachHang" HeaderText="Tên khách hàng"></asp:BoundField>
                        <asp:BoundField DataField="NguoiGiao" HeaderText="Người giao"></asp:BoundField>
                        <asp:BoundField DataField="TongTien" HeaderText="Tổng tiền" DataFormatString="{0:n0}">
                            <ItemStyle HorizontalAlign="Right"></ItemStyle>
                        </asp:BoundField>
                        <asp:BoundField DataField="TrangThai" HeaderText="Trạng thái">
                            <ItemStyle HorizontalAlign="Center"></ItemStyle>
                        </asp:BoundField>
                        <asp:BoundField DataField="IsXetDuyet" HeaderText="IsXetDuyet" Visible="False"></asp:BoundField>
                        <asp:TemplateField>
                            <ItemTemplate>
                                <asp:LinkButton ID="btnSuaPhieuXuatBanLe" ClientIDMode="Static" runat="server" ToolTip="Sửa phiếu"
                                    CssClass="btn btn-warning" maphieu='<%# Eval("MaPhieu") %>' OnClientClick="suaphieuxuatbanle(this);" href="javascript:void(0)">
                                    <i class="glyphicon glyphicon-edit"></i>
                                </asp:LinkButton>
                                <asp:LinkButton ID="btnXoaPhieuXuatBanLe" ClientIDMode="Static" runat="server" ToolTip="Xóa phiếu"
                                    CssClass="btn btn-danger" CommandArgument='<%# Eval("MaPhieu") %>'
                                    OnClick="btnDelete_Click" OnClientClick="return showconfirm(this.id);">
                                    <i class="glyphicon glyphicon-trash"></i>
                                </asp:LinkButton>
                                <asp:LinkButton ID="btnDuyetPhieuXuatBanLe" ClientIDMode="Static" runat="server" ToolTip="Duyệt phiếu"
                                    CssClass="btn btn-info" CommandArgument='<%# Eval("MaPhieu") %>' OnClick="btnDuyetPhieuXuatBanLe_Click">
                                    <i class="glyphicon glyphicon-check"></i>
                                </asp:LinkButton>
                                <asp:LinkButton ID="btnViewPhieu" ClientIDMode="Static" runat="server" ToolTip="Xem thông tin phiếu"
                                    CssClass="btn btn-success" maphieu='<%# Eval("MaPhieu") %>' OnClientClick="viewphieuxuatbanle(this);" href="javascript:void(0)">
                                    <i class="glyphicon glyphicon-search"></i>
                                </asp:LinkButton>
                            </ItemTemplate>
                            <ItemStyle HorizontalAlign="Center" />
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-md-6">
        </div>
        <div class="col-md-6" style="text-align: right;">
            <asp:DataList RepeatDirection="Horizontal" runat="server" ID="dlPager" OnItemCommand="dlPager_ItemCommand"
                CssClass="tbPage">
                <ItemTemplate>
                    <asp:LinkButton Enabled='<%#Eval("Enabled") %>' runat="server" ID="lnkPageNo" Text='<%#Eval("Text") %>'
                        CommandArgument='<%#Eval("Value") %>' CommandName="PageNo"></asp:LinkButton>
                </ItemTemplate>
            </asp:DataList>
        </div>
    </div>
    <asp:HiddenField ID="hfPageIndex" runat="server" Value="1" />
    <script type="text/javascript">
        $(function () {
            $("#li_phieuxuatbanle").addClass("active");
            $("#li_hethongnhapxuat").addClass("active");
        });
        var confirmed = false;
        function showconfirm(controlId) {
            if (confirmed) return true;
            bootbox.confirm("Bạn có chắc chắn xóa?", function (result) {
                if (result) {
                    if (controlId != null) {
                        var controlToClick = document.getElementById(controlId);
                        if (controlToClick != null) {
                            confirmed = true;
                            $("#form_Main").validate().cancelSubmit = true;
                            controlToClick.click();
                            confirmed = false;
                        }
                    }
                }
            });
            return false;
        }
    </script>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="FormContent" runat="server">
    <div id="div_phieuxuatbanle" class="modal fade" tabindex="-1" role="dialog" data-backdrop="static"
        data-focus-on="#txtNguoiGiao" data-width="98%" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" style="line-height: 1;">
                        <span>&times;</span><span class="sr-only">Close</span></button>
                    <h4 class="modal-title" id="myModalLabel">Phiếu xuất bán lẻ</h4>
                </div>
                <div class="modal-body modal-fullheight">
                    <div class="row">
                        <div class="col-xs-12 col-md-12">
                            <ul id="ul_tab_phieuxuatbanle" class="nav nav-tabs" role="tablist">
                                <li role="presentation" class="active"><a href="#tab_phieuxuatbanle" role="tab" data-toggle="tab">Phiếu xuất bán lẻ</a></li>
                                <li role="presentation"><a href="#tab_phieuxuatbanle_chitiet" role="tab" data-toggle="tab">Chi tiết phiếu</a></li>
                            </ul>
                            <div class="tab-content">
                                <div role="tabpanel" class="tab-pane active" id="tab_phieuxuatbanle">
                                    <form id="form_phieuxuatbanle_thongtinphieu">
                                        <uc1:uc_Phieu ID="uc_Phieu1" runat="server" />
                                    </form>
                                </div>
                                <div role="tabpanel" class="tab-pane" id="tab_phieuxuatbanle_chitiet">
                                    <form id="form_phieuxuatbanle_chitietphieu">
                                        <uc2:uc_ChiTietPhieu ID="uc_ChiTietPhieu1" runat="server" />
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-xs-4 col-md-4">
                            <ul class="nav nav-tabs" role="tablist">
                                <li role="presentation" class="active"><a href="#tab_danhsach" role="tab" data-toggle="tab">Vật tư xuất</a></li>
                            </ul>
                            <div class="tab-content">
                                <div role="tabpanel" class="tab-pane active" id="tab_danhsach">
                                    <div class="table-responsive">
                                        <table id="tb_phieuxuatbanle">
                                        </table>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-xs-8 col-md-8">
                            <ul class="nav nav-tabs" role="tablist">
                                <li role="presentation" class="active"><a href="#tab_danhsach_chitiet" role="tab" data-toggle="tab">Thông tin chi tiết vật tư xuất</a></li>
                            </ul>
                            <div class="tab-content">
                                <div role="tabpanel" class="tab-pane active" id="tab_danhsach_chitiet">
                                    <div class="table-responsive">
                                        <table id="tb_phieuxuatbanle_chitiet">
                                        </table>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div id="div_phieuxuatbanle_view" class="modal fade" tabindex="-1" role="dialog" data-backdrop="static"
        data-width="98%" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" style="line-height: 1;">
                        <span>&times;</span><span class="sr-only">Close</span></button>
                    <h4 class="modal-title" id="myModalLabel_view">Phiếu xuất bán lẻ</h4>
                </div>
                <div class="modal-body modal-fullheight">
                    <uc4:uc_ViewPhieu ID="uc_ViewPhieu1" runat="server" />
                </div>
            </div>
        </div>
    </div>
</asp:Content>
